<template>
  <keep-alive exclude="Assets,Actor">
    <component v-bind:is="currentComponent" v-bind="curProps" :ref="curComponentName"></component>
  </keep-alive>
</template>


<script>

import Assets from './Assets';
import ActorAsset from './ActorAsset';
import ShellAssets from './ShellAssets';
export default {

  name:'ShellAssetsFactory',
  props:{
    menuCode: String
  },
  data () {
    return {
        currentComponent:ShellAssets,
        curProps:{menuCode:this.menuCode},
        curComponentName:'ShellAssets'
    }
  },
  methods:{
    setCurrentComponent:function(type,data){
      if(type=="Assets")
      {
         this.curProps = data;
         this.currentComponent = Assets;
         this.curComponentName = 'Assets';

      }
      else if(type=="Actor")
      {
         this.curProps = data;
         this.currentComponent = ActorAsset;
         this.curComponentName = 'ActorAsset';
      }
      else if(type=="goBack"){
        this.currentComponent = ShellAssets;
        this.curComponentName = 'ShellAssets';
      }
    },
    enterDown(){
      if(this.$refs[this.curComponentName]&&this.$refs[this.curComponentName].enterDown){
        this.$refs[this.curComponentName].enterDown()
      }
    }
  },
  mounted: function mounted() {
    //this.$router.push({ path: '/ShellAssets' });//跳转到该路由
  }
}


</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
